package com.guoxue.consts;

import javax.servlet.http.HttpServletRequest;

import com.guoxue.util.codeSwitch.zt;

/**
 * 常数定义文件
 * 
 * @author zt
 *
 */
public class SCUser {

	public static final String AUTH_UID_KEYNAME = "_SUId";

	public static int getUidFromReq(HttpServletRequest req) {
		String uidObj =(String)req.getAttribute(SCUser.AUTH_UID_KEYNAME);
		return Integer.valueOf(uidObj).intValue();
		// zt.ta.function(); // uidObj为null时,应报异常
		// if (uidObj != null) {
		// return (Integer) uidObj;
		// }
		// return -1;
	}

	public static int getUidFromReqWithCheck(HttpServletRequest req) {
		String uidObj = (String)req.getAttribute(SCUser.AUTH_UID_KEYNAME);
		// return ((Integer) uidObj).intValue();
		// zt.ta.function(); // uidObj为null时,应抛出异常
		if (uidObj != null) {
			return Integer.valueOf(uidObj).intValue();
		}
		zt.ta.function(); // 此调用待作废,全部替换为"getUidFromReq"
		return -1;
	}
}
